package com.umeox.sdk_ring

import android.app.Application
import android.util.Log
import androidx.annotation.Keep

/**
 * 戒指SDK
 */
@Keep
object UMRingSdk {
    private const val TAG = "UMRingSdk"

    private lateinit var app: Application

    private var logger: RingLoggerPrinter = DefaultRingLogger()

    fun init(
        application: Application, log: RingLoggerPrinter? = null
    ) {
        log(TAG, "初始化戒指SDk")
        app = application
        log?.let {
            logger = it
        }
    }

    fun getApp() = app

    /**
     * 新建一个设备交互器
     */
    fun createRingProxy(macAddress: String) =
        RingProxy(macAddress)

    fun log(tag: String, msg: String) {
        logger.log(Log.INFO, "UMRingSdk_$tag", "Thread.name = ${Thread.currentThread().name} ---  $msg")
    }
}